import { observable, action } from 'mobx';
import { WeaTools } from 'ecCom';
import { WeaTableNew } from 'comsMobx';

const { TableStore } = WeaTableNew;

export default class Test {
  @observable state_1 = {
    title: '集成测试1',
    data: [],
    sysid: '',
    fields: {},
    flag: 'false',
    selectMap: {},
  };
  @observable table = {
    dataKey: '',
  };

  @action
  addDataInState1() {
    this.state_1.data.push({
      name: 'test',
    });
  }

  @action
  getDatas() {
    WeaTools.callApi('/api/ec/dev/demo/hrm', 'GET', {}).then((result) => {
	  this.table.dataKey = result.sessionkey;
	  let comsWeaTableStore = new TableStore();
      comsWeaTableStore.getDatas(this.table.dataKey);
    });
  }
}
